package com.doan.classcauhoi;

import java.util.List;

import com.doan.gameshow.R;

import android.app.Activity;
import android.content.Intent;
import android.os.Bundle;
import android.widget.HorizontalScrollView;
import android.widget.ImageView;
import android.widget.RadioButton;
import android.widget.RadioGroup;
import android.widget.TableLayout;
import android.widget.TableRow;
import com.doan.classcauhoi.MainActivity;

public class HienThiCacCauHoi extends Activity {
	int index=0;
	protected void onCreate(Bundle savedInstanceState) {
		// TODO Auto-generated method stub
		super.onCreate(savedInstanceState);
		setContentView(R.layout.hienthi_danhsachcauhoi);
		List<Cauhoi> list=MainActivity.ds_cauhoi;
				
		HorizontalScrollView hsv = new HorizontalScrollView(this);
        TableLayout ll=new TableLayout(this);        
        RadioGroup rdbGroup=new RadioGroup(this);
        for(int i=1;i<=list.size();i++) {
            TableRow tbrow=new TableRow(this);
            //Thêm Radio Button câu hỏi vào
            RadioButton rdbCauHoi=new RadioButton(this);
            rdbCauHoi.setChecked(false);
            rdbCauHoi.setText("Câu: "+(index+1)+list.get(index).cauhoi.toString()); 
            tbrow.addView(rdbCauHoi); 
            //Thêm ImageView xem có gắn cờ hay không           
            ImageView img;            
            if(list.get(index).isFlag()==true)
            {
            	img=new ImageView(this);
            	img.setBackgroundResource(R.drawable.ic_flag48);
            	tbrow.addView(img);
            }                      
            ll.addView(tbrow);
            index++;
        }
        rdbGroup.addView(ll);
        hsv.addView(rdbGroup);
        setContentView(hsv);
	}
	@Override
	protected void onNewIntent(Intent intent) {
		// TODO Auto-generated method stub
		super.onNewIntent(intent);
	}
	
	
	

}
